home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
WebObjects
/
WOF
/
WO_10_NT.EXE
/
WO.Z
/
Palette.wos
< prev
next >
Wrap
Text File
|
1996-01-27
|
2KB
|
58 lines
/*
* Palette.wos
* You may freely copy, distribute, and reuse the code in this example.
* NeXT disclaims any warranty of any kind, expressed or implied, as to its
* fitness for any particular use.
*
* This example was written with a Beta version of WebObjects.
*
* Written by Nico Popp
*
* Palette is a subcomponent (or child component) that's nested in the
* component associated with the page Main. It messages the parent
* component Main using a WOAction object callBack.
*
* When the user clicks on digit, the Palette's click method is
* triggered. This sets the value of the selection variable to the
* digit the user clicked on. Since the selection variable of the
* child component is tied to the number variable of the parent (in the
* Main.wod declarations file), the number variable is modified
* accordingly. Next, the click method sends the WOAction
* object callBack an invoke message. This invokes the displaySelection
* method in the parent's script Main.wos. Finally, the displaySelection
* method generates a new Main page that reflects the digit clicked by
* the user.
*
*/
id digits, digit;
// Repetition's list and item
id selection;
// The clicked digit
action callBack;
// A WOAction object. This is a mechanism for a component to call back
// its parent page (or component). Take a look at the corresponding
// declaration in Main.wod.
/*
* Create the array of digits
* (both for request handling and response generation)
*/
- awake
{
digits = @(1, 2, 3, 4, 5, 6, 7, 8, 9);
}
/*
* Invoked by a WOHyperlink when it has been clicked
*/
- click
{
selection = digit;
return [callBack invoke];
}